package com.alvis.media.service.impl;

import com.alvis.media.domain.VideoInfo;
import com.alvis.media.repository.VideoInfoMapper;
import com.alvis.media.service.VideoInfoService;
import com.alvis.media.viewmodel.video.VideoPageRequestVM;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author hh学java
 * @version 1.0
 */
@Service
public class VideoInfoServiceImpl extends BaseServiceImpl<VideoInfo> implements VideoInfoService {

    private final VideoInfoMapper videoInfoMapper;

    @Autowired
    public VideoInfoServiceImpl(VideoInfoMapper videoInfoMapper) {
        super(videoInfoMapper);
        this.videoInfoMapper = videoInfoMapper;
    }

    @Override
    public PageInfo<VideoInfo> videoPage(VideoPageRequestVM model) {
        return PageHelper.startPage(model.getPageIndex(), model.getPageSize(), "video_Id desc").doSelectPageInfo(() ->
                videoInfoMapper.videoPage(model)
        );
    }
}
